#include "xxWorker.h"

xxWorker::xxWorker(QObject* parent)
	:QObject(parent)
{
}

xxWorker::~xxWorker()
{
}

void xxWorker::init()
{
	static bool s_inited = false;

	if (s_inited == true)
		return;

	//m_networkManager = new QNetworkAccessManager(this);
	m_timer = new QTimer();

	connect(m_timer, &QTimer::timeout, this, &xxWorker::xxWorkFunc);

	m_timer->start(5000);

	m_runService = true;
	s_inited = true;
}

void xxWorker::uninit()
{
	Q_ASSERT(m_timer != nullptr);

	m_runService = false;
	if (m_timer != nullptr) m_timer->stop();
}

void xxWorker::getResult()
{
	QMutexLocker locker(&mutex);  // 加锁保证线程安全
	return; // xxxx
}

void xxWorker::xxWorkFunc()
{
	// 执行所需业务逻辑
}
